<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
	<meta charset="utf-8">
	<title>学生请假管理系统</title>
	<meta name="renderer" content="webkit">
	<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
	<meta http-equiv="Access-Control-Allow-Origin" content="*">
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
	<meta name="apple-mobile-web-app-status-bar-style" content="black">
	<meta name="apple-mobile-web-app-capable" content="yes">
	<meta name="format-detection" content="telephone=no">
	<link rel="icon" href="/favicon.ico">
	<link rel="stylesheet" href="/resources/layui/css/layui.css" media="all"/>
	<link rel="stylesheet" href="/resources/css/index.css" media="all"/>
	<link rel="stylesheet" href="/resources/css/themes/default.css" media="all">
	<link rel="stylesheet" href="/resources/font/css/font-awesome.min.css" media="all">
</head>
<body class="layui-layout-body layuimini-all">
<div class="layui-layout layui-layout-admin">
	<!-- 顶部 -->
	<div class="layui-header header">
		<div class="layui-main mag0">
			<a href="#" class="logo">学生请假系统</a>
			<!-- 显示/隐藏菜单 -->
			<a href="javascript:;" class="seraph hideMenu icon-caidan"></a>
			<!-- 顶部右侧菜单 -->
			<ul class="layui-nav top_menu">
				<li class="layui-nav-item" pc>
					<a href="javascript:;" class="clearCache"><i class="layui-icon" data-icon="&#xe640;">&#xe640;</i><cite>清除缓存</cite></a>
				</li>
				<li class="layui-nav-item" lay-unselect>
					<a href="javascript:;" class="refresh refreshThis"><i class="fa fa-refresh"></i><cite>刷新</cite></a>
				</li>
				<li class="layui-nav-item" id="userInfo">
					<a href="javascript:;"><img src="/resources/images/face.jpg" class="layui-nav-img userAvatar" width="35" height="35"><cite class="adminName" th:text="${session.user.name}"></cite></a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:;" data-url="/sys/toChangePwd"><i class="seraph icon-xiugai" data-icon="icon-xiugai"></i><cite>修改密码</cite></a>
						</dd>
						<dd><a href="javascript:;" class="signOut"><i class="seraph icon-tuichu"></i><cite>退出</cite></a></dd>
					</dl>
				</li>
			</ul>
		</div>
	</div>
	<!-- 左侧导航 -->
	<div class="layui-side layui-bg-black layuimini-menu-left">
		<div class="user-photo">
			<a class="img"><img src="/resources/images/face.jpg" class="userAvatar"></a>
			<p>你好！<span class="userName" th:text="${session.user.name}"></span>, 欢迎登录</p>
		</div>
		<!-- 搜索 -->
		<div class="layui-form component">
			<select name="search" id="search" disabled="disabled" lay-search lay-filter="searchPage">
				<option value="">搜索页面或功能</option>
			</select>
			<i class="layui-icon">&#xe615;</i>
		</div>
		<div style="margin-top: 10px"></div>
		<div class="navBar layui-side-scroll" id="navBar">
			<ul class="layui-nav layui-nav-tree">
				<li class="layui-nav-item layui-this">
					<a href="javascript:;" data-url="/sys/toDeskManager"><i class="layui-icon" data-icon=""></i><cite>系统首页</cite></a>
				</li>
			</ul>
		</div>
	</div>
	<!-- 右侧内容 -->
	<div class="layui-body layui-form">
		<div class="layui-tab mag0" lay-filter="bodyTab" id="top_tabs_box">
			<ul class="layui-tab-title top_tab" id="top_tabs">
				<li class="layui-this" lay-id=""><i class="layui-icon">&#xe68e;</i> <cite>系统首页</cite></li>
			</ul>
			<ul class="layui-nav closeBox">
				<li class="layui-nav-item">
					<a href="javascript:;"><i class="layui-icon caozuo">&#xe643;</i>页面操作</a>
					<dl class="layui-nav-child">
						<dd><a href="javascript:;" class="refresh refreshThis"><i class="layui-icon">&#xe669;</i>刷新当前</a></dd>
						<dd><a href="javascript:;" class="closePageOther"><i class="layui-icon">&#x1006;</i> 关闭其他</a>
						</dd>
						<dd><a href="javascript:;" class="closePageAll"><i class="layui-icon">&#x1007;</i> 关闭全部</a></dd>
					</dl>
				</li>
			</ul>
			<div class="layui-tab-content clildFrame">
				<div class="layui-tab-item layui-show">
					<iframe src="/sys/toDeskManager"></iframe>
				</div>
			</div>
		</div>
	</div>
	<!-- 底部 -->
	<div class="layui-footer footer">
		<p><span>Copyright SLS @2021 YangJinRui</span></p>
	</div>

	<!-- 移动导航 -->
	<div class="site-tree-mobile"><i class="layui-icon">&#xe602;</i></div>
	<div class="site-mobile-shade"></div>
</div>


<script type="text/javascript" src="/resources/layui/layui.js"></script>

<script type="text/javascript">
	var $, tab, dataStr, layer;
	layui.config({
		base: "/resources/js/"
	}).extend({
		"bodyTab": "bodyTab"
	})
	layui.use(['bodyTab', 'form', 'element', 'layer', 'jquery'], function () {
		var form = layui.form,
				element = layui.element;
		$ = layui.$;
		layer = parent.layer === undefined ? layui.layer : top.layer;
		tab = layui.bodyTab({
			openTabNum: "50",  //最大可打开窗口数量
			url: "/menu/loadIndexLeftMenuJson" //获取菜单json地址
		});

		//渲染左侧菜单
		function getData(json) {
			$.getJSON(tab.tabConfig.url, function (data) {
				dataStr = data.data;
				tab.render();
			})
		}

		//清除缓存
		$(".clearCache").click(function(){
			window.sessionStorage.clear();
			window.localStorage.clear();
			var index = layer.msg('清除缓存中，请稍候',{icon: 16,time:false,shade:0.8});
			setTimeout(function(){
				layer.close(index);
				layer.msg("缓存清除成功！");
			},1000);
		})


		//隐藏左侧导航
		$(".hideMenu").click(function(){
			if($(".topLevelMenus li.layui-this a").data("url")){
				layer.msg("此栏目状态下左侧菜单不可展开");  //主要为了避免左侧显示的内容与顶部菜单不匹配
				return false;
			}
			$(".layui-layout-admin").toggleClass("showMenu");
			//渲染顶部窗口
			tab.tabMove();
		})

		//手机设备的简单适配
		$('.site-tree-mobile').on('click', function(){
			$('body').addClass('site-mobile');
		});
		$('.site-mobile-shade').on('click', function(){
			$('body').removeClass('site-mobile');
		});

		//退出登录
		$(".signOut").click(function(){
			$.ajax({
				type:"POST",//为post请求
				url:"/logout"
			});
			location.href="/sys/toLogin";
		})

		getData("contentManagement");

		// 添加新窗口
		$("body").on("click", ".layui-nav .layui-nav-item a:not('.mobileTopLevelMenus .layui-nav-item a')", function () {
			//如果不存在子级
			if ($(this).siblings().length == 0) {
				addTab($(this));
				$('body').removeClass('site-mobile');  //移动端点击菜单关闭菜单层
			}
			$(this).parent("li").siblings().removeClass("layui-nav-itemed");
		})

	})

	//打开新窗口
	function addTab(_this) {
		tab.tabAdd(_this);
	}

</script>
</body>
</html>